$(function () {
    // run the currently selected effect
    function runEffect() {
        var selectedEffect = "slide";


        var options = {};
        // run the effect
        $("#effect").show(selectedEffect, options, 2000, callbackAviso);

    };

    //callback function to bring a hidden box back
    function callbackAviso() {
        
        var options = {};
        if (typeof callbackAviso.ContadorAviso == 'undefined') {

            callbackAviso.ContadorAviso = 0;

        }

        setTimeout(function () {

            switch (callbackAviso.ContadorAviso) {
                case 1:
                    $("#effect").hide();

                    $("#effect2").show("slide", options, 1000, callbackAviso);
                    break;
                case 2:
           
                    $("#effect2").hide();
                    $("#effect3").show("slide", options, 1000, callbackAviso);
                    break;
                case 3:

                    $("#effect3").hide();
                    $("#effect4").show("slide", options, 1000, callbackAviso);
                    break;
                case 4:

                    $("#effect4").hide();
                    $("#effect").show("slide", options, 1000, callbackAviso);
                    break;
            }

        }
                , 2000);

        if (callbackAviso.ContadorAviso == 4) {

            callbackAviso.ContadorAviso = 1;

        }
        else {

            callbackAviso.ContadorAviso++;

        }

    };

    // set effect from select menu value
    /* $("#button").click(function () {
    runEffect();
    return false;
    });*/

    $("#effect").hide();
    $("#effect2").hide();
    $("#effect3").hide();
    $("#effect4").hide();
    runEffect();

});